<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>人员</title>
    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css"/>
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/supplier/common/css/style.css"/>
    <!--Layui-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--extended-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/extended.css"/>
    <!--公用样式JS-->
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.js" charset="utf-8"></script>
</head>
<style>
    .Right {
        width: 100%;
        overflow-y: scroll;
    }

    .widthle {
        width: 35%;
        display: inline-block;
        text-align: right;
    }

    .widthle25 {
        width: 25%;
        display: inline-block;
        text-align: right;
    }

    .widthle50 {
        width: 50%;
        display: inline-block;
        text-align: right;
    }

    .widinput {
        width: 60% !important;
    }

    xm-select {
        min-height: 30px;
        line-height: 30px;
    }

    .tab-name-unselect {
        font-weight: bolder;
        font-size: 18px !important;
        color: #888888;
    }

    .tab-name-select {
        font-weight: bolder;
        font-size: 18px !important;
        color: #1e9fff !important;
        background-color: #ffffff !important;
    }

    .layui-tab-brief > .layui-tab-more li.layui-this:after, .layui-tab-brief > .layui-tab-title .layui-this:after {
        border-bottom: 2px solid #1e9fff !important;
    }

    .layui-laypage-limits select {
        width: 70px;
    }

    .layui-table tbody tr:hover, .layui-table-hover, .layui-table-click {
        background-color: rgba(255, 255, 255, 0);
    }

</style>

<body>
<!--头部-->

<!--容器-->
<div class="layui-container"
     style="background-color: #ffffff;width:96%;margin-top:60px;padding:16px;border-radius: 10px">


    <!--tab页面-->
    <div class="layui-tab layui-tab-brief" lay-filter="demo">
        <ul id="tab-uls" class="layui-tab-title" style="margin: 0px 10px 10px 10px">
            <li class="layui-this tab-name-select" value="1" >按人员统计</li>
            <li class="tab-name-unselect"  value="2" >按擅长领域统计</li>
            <li class="tab-name-unselect" value="3" >按证书拥有人统计</li>
        </ul>

        <div class="layui-tab-content" style="height: auto;">
            <div class="layui-tab-item layui-show" style="margin-left: 0px">
                <!--筛选行-->
                <from id = "form-search">
                    <div style="background-color: #F1F4FB;border-radius: 5px;padding:14px 10px;">
                        <div class="layui-row">
                            <!--计划类别-->
                            <div class="layui-col-md3">
                                <lebel class="widthle">姓名:</lebel>
                                <input type="text" style="border: 1px solid #DDDDDD;width: 58%;" name="name" id="name"
                                       autocomplete="off" placeholder="姓名">
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle">部门:</span>
                                <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="deptName"
                                       id="deptName"
                                       autocomplete="off" placeholder="部门">
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle"> 职务:</span>
                                <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="duty" id="duty"
                                       autocomplete="off" placeholder="职务">
                            </div>
                        </div>
                        <div class="layui-row">

                            <div class="layui-col-md3">
                                <span class="widthle">第一学历:</span>
                                <select name="firstXl" id="firstXl" lay-ignore>
                                    <option value="">全部</option>
                                    <#list edulist as vo>
                                        <option value="${vo.badtCode}">${vo.badtName}</option>
                                    </#list>
                                </select>
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle">第一学历学校:</span>
                                <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="firstSchool"
                                       id="firstSchool"
                                       autocomplete="off" placeholder="学校">
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle">第一学历专业:</span>
                                <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="firstZy"
                                       id="firstZy"
                                       autocomplete="off" placeholder="专业">
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md3">
                                <span class="widthle">最终学历:</span>
                                <select name="lastXl" id="lastXl" lay-ignore>
                                    <option value="">全部</option>
                                    <#list edulist as vo>
                                        <option value="${vo.badtCode}">${vo.badtName}</option>
                                    </#list>
                                </select>
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle">最终学历学校:</span>
                                <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="lastSchool"
                                       id="lastSchool"
                                       autocomplete="off" placeholder="学校">
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle">最终学历专业:</span>
                                <input type="text" class="widinput" style="border: 1px solid #DDDDDD" name="lastZy"
                                       id="lastZy"
                                       autocomplete="off" placeholder="专业">
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md3">
                                <span class="widthle">婚姻状况:</span>
                                <select name="hyStatus" id="hyStatus" lay-ignore>
                                    <option value="">全部</option>
                                    <#list hyulist as vo>
                                        <option value="${vo.badtName}">${vo.badtName}</option>
                                    </#list>
                                </select>
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle">政治面貌:</span>
                                <select name="political" id="political" lay-ignore>
                                    <option value="">全部</option>
                                    <#list politicalList as vo>
                                        <option value="${vo.badtName}">${vo.badtName}</option>
                                    </#list>
                                </select>
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle" style="float: left;width: 36.3%">所属公司:</span>
                                <div style="display: inline-block;width: 60%;">
                                    <div class="slt" id="deptNameslt"></div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md3">
                                <span class="widthle">擅长领域:</span>
                                <select name="doBest" id="doBest" class="ml8 widinput">
                                    <option value="">全部</option>
                                    <#list doBestList as vo>
                                        <option value="${vo.badtCode}">${vo.badtName}</option>
                                    </#list>
                                </select>
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle">性别:</span>
                                <select name="sex" id="sex" lay-ignore>
                                    <option value="">全部</option>
                                    <option value="1">男</option>
                                    <option value="0">女</option>
                                </select>
                            </div>
                            <div class="layui-col-md4">
                                <span class="widthle" style="display: inline-block;text-align: right;">籍贯:</span>
                                <input type="text" class="widinput" style="border: 1px solid #DDDDDD;" name="birthPlace"
                                       id="birthPlace"
                                       autocomplete="off" placeholder="籍贯">
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md5" style="padding-left:2%">
                                <span class="widthle25">工作年限范围:</span>
                                <input id="minArrWorkYear" type="text" style="border: 1px solid #DDDDDD;width: 32%;"
                                       placeholder="最小值(年)">
                                <span>至</span>
                                <input id="maxArrWorkYear" type="text" style="border: 1px solid #DDDDDD;width: 32%;"
                                       placeholder="最大值(年)">
                            </div>

                            <div class="layui-col-md6" style="padding-left:2%">
                                <span class="widthle25">到公司时间范围:</span>
                                <input id="minArrComYear" type="text" style="border: 1px solid #DDDDDD;width: 32%;"
                                       placeholder="最小值(年)">
                                <span>至</span>
                                <input id="maxArrComYear" type="text" style="border: 1px solid #DDDDDD;width: 32%;"
                                       placeholder="最大值(年)">
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-md5" style="padding-left:2%">
                                <span class="widthle25">年龄:</span>
                                <input type="text" style="border: 1px solid #DDDDDD;width: 32%;" name="minAge" id="minAge"
                                       autocomplete="off" placeholder="最小值">
                                <span>至</span>
                                <input type="text" style="border: 1px solid #DDDDDD;width:32%;" name="maxAge" id="maxAge"
                                       autocomplete="off" placeholder="最大值">
                            </div>
                            <div class="layui-col-md3" style="padding-left:2%">
                                <span class="widthle50">是否接受出差:</span>
                                <select name="bussTravel" style="width: 35%;" id="bussTravel" lay-ignore>
                                    <option value="">全部</option>
                                    <option value="1">接受</option>
                                    <option value="0">不接受</option>
                                </select>
                            </div>
                            <div class="layui-col-md2" style="text-align: right;width: 90%;">
                                <input class="layui-btn layui-btn-normal" style="border-radius:5px;" type="button" value="筛选" onclick="query(1)">
                                <input class="layui-btn layui-btn-danger" style="border-radius:5px;background-color: #FF5722;" type="button" value="重置" onclick="resetQuery()">
                            </div>
                        </div>
                    </div>
                </from>
            </div>
            <div class="layui-tab-item" style="margin-left: 0px">
                <!--筛选行-->
                <div style="background-color: #F1F4FB;border-radius: 5px;padding:14px 10px;">
                    <from id = "form-search1">
                        <div style="background-color: #F1F4FB;border-radius: 5px;padding:14px 10px;">
                            <div class="layui-row">
                                <div class="layui-col-md6" style="padding-left:2%">
                                    <span>人员擅长领域:</span>
                                    <select name="doBests" id="doBests" style="width: 200px;">
                                        <option value="">全部</option>
                                        <#list doBestList as vo>
                                            <option value="${vo.badtCode}">${vo.badtName}</option>
                                        </#list>
                                    </select>
                                </div>
                                <div class="layui-col-md3" style="text-align: center;float:right;width: 20%">
                                    <input class="layui-btn layui-btn-normal" style="border-radius:5px;" type="button" value="筛选" onclick="query(2)">
                                    <input class="layui-btn layui-btn-danger" style="border-radius:5px;background-color: #FF5722;" type="button" value="重置" onclick="resetQuery()">
                                </div>
                            </div>
                        </div>
                    </from>
                </div>
            </div>
            <div class="layui-tab-item" style="margin-left: 0px">
                <!--筛选行-->
                <div style="background-color: #F1F4FB;border-radius: 5px;padding:14px 10px;">
                    <from id = "form-search2">
                        <div style="background-color: #F1F4FB;border-radius: 5px;padding:14px 10px;">
                            <div class="layui-row">
                                <div class="layui-col-md4" style="padding-left:1%">
                                    <span>证书名称:</span>
                                    <input id="certName" class="layui-input layui-input-inline" type="text" placeholder="证书" style="width: 50%">
                                </div>
                                <div class="layui-col-md3" style="text-align: center;float:right;width: 20%">
                                    <input class="layui-btn layui-btn-normal" style="border-radius:5px;" type="button" value="筛选" onclick="query(3)">
                                    <input class="layui-btn layui-btn-danger" style="border-radius:5px;background-color: #FF5722;" type="button" value="重置" onclick="resetQuery()">
                                </div>
                            </div>
                        </div>
                    </from>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="layui-container"
     style="background-color: #ffffff;width:96%;margin-top:30px;padding:16px;border-radius: 10px;">
    <#--    <div class="layui-row">
            <div class="layui-col-md3 layui-col-md-offset9">
                <input class="layui-btn layui-btn-normal layui-btn-sm fr ml10" type="button" value="导出Excel" onclick="exportTable()">
                <input class="layui-btn layui-btn-danger layui-btn-sm fr" type="button" value="预览Excel" onclick="viewTable()">
            </div>
        </div>-->
    <div id="">
        <@shiro.hasPermission name="search:export">
            <input class="layui-btn layui-btn-normal layui-btn-sm fr ml10" type="button" value="导出Excel"
                   onclick="exportTab()">
        </@shiro.hasPermission>
        <@shiro.hasPermission name="search:view">
            <input class="layui-btn layui-btn-danger layui-btn-sm fr" type="button" value="预览Excel"
                   onclick="viewTab()">
        </@shiro.hasPermission>
    </div>
    <div class="layui-row">
        <table id="tableList" class="layui-hide" lay-filter="tableList"></table>
    </div>
</div>
<script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
<script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/tabs.js"></script>
<script type="text/javascript" src="${re.contextPath}/pageoffice.js" id="po_js_main"></script>
<#-- 可以多选的下拉框 -->
<script src="${re.contextPath}/plugin/layui/xm-select.js"></script>
<!-- 公共配置第三方组件 -->
<script type="text/javascript">
    layui.config({
        version: false,
        debug: false,
        base: "${re.contextPath}/plugin/layui/lay/extra/"
    })

</script>
<script type="text/javascript">
    var defaultTabInd = 0;
    var layer;
    var form = layui.form;
    var table = null;
    var _xstjlcpselect;
    var tableIns = null;
    //注意进度条依赖 element 模块，否则无法进行正常渲染和功能性操作
    var element = "";
    layui.use('element', function () {
        element = layui.element;
        getTableByIndex(0)
        initsl();
        element.on('tab(demo)', function (data) {
            console.log(data);
            if (defaultTabInd == data.index) {
            } else {
                defaultTabInd = data.index;
                $('#form-search').find('input[type=text],select,input[type=number]').each(function() {
                    $(this).val('');
                });
                $('#form-search1').find('input[type=text],select,input[type=number]').each(function() {
                    $(this).val('');
                });
                $('#form-search2').find('input[type=text],select,input[type=number]').each(function() {
                    $(this).val('');
                });
                $('#tab-uls li').addClass("tab-name-unselect");
                $('#tab-uls li').removeClass("tab-name-select");
                $('#tab-uls li:eq(' + data.index + ')').removeClass("tab-name-unselect");
                $('#tab-uls li:eq(' + data.index + ')').addClass("tab-name-select");
                getTableByIndex(data.index);
            }
        });


    });
    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#beginDate' //指定元素
        });
        laydate.render({
            elem: '#endDate' //指定元素
        });
    });

    function query(obj) {
        var jsondata = {};
        if (obj == '2') {
            var doBest = $('#doBests').val();
            jsondata = {
                doBest: doBest
            };
        } else if (obj == '3') {
            var certName = $('#certName').val();
            jsondata = {
                certName: certName
            };
        } else if (obj == '1') {
            var name = $('#name').val();
            var deptName = $('#deptName').val()
            var companyName = _xstjlcpselect.getValue('valueStr');
            var duty = $('#duty').val();
            var sex = $('#sex').val();
            var firstXl = $('#firstXl').val();
            var firstZy = $('#firstZy').val();
            var firstSchool = $('#firstSchool').val();
            var lastXl = $('#lastXl').val();
            var lastZy = $('#lastZy').val();
            var lastSchool = $('#lastSchool').val();
            var hyStatus = $('#hyStatus').val();
            var political = $('#political').val();
            var doBest = $('#doBest').val();
            var bussTravel = $('#bussTravel').val();
            var birthPlace = $('#birthPlace').val();
            var minArrWorkYear = $('#minArrWorkYear').val();
            var maxArrWorkYear = $('#maxArrWorkYear').val();
            var minArrComYear = $('#minArrComYear').val();
            var maxArrComYear = $('#maxArrComYear').val();
            var minAge = $('#minAge').val();
            var maxAge = $('#maxAge').val();
            jsondata = {
                name: name,
                deptName: deptName,
                duty: duty,
                sex: sex,
                firstXl: firstXl,
                firstZy: firstZy,
                firstSchool: firstSchool,
                lastXl: lastXl,
                lastZy: lastZy,
                lastSchool: lastSchool,
                hyStatus: hyStatus,
                political: political,
                doBest: doBest,
                bussTravel: bussTravel,
                birthPlace: birthPlace,
                minArrWorkYear: minArrWorkYear,
                maxArrWorkYear: maxArrWorkYear,
                minArrComYear: minArrComYear,
                maxArrComYear: maxArrComYear,
                maxAge: maxAge,
                minAge: minAge,
                companyName: companyName
            };
        }

        table.reload('tableList', {where: jsondata});
    }

    function resetQuery() {

        $('#form-search').find('input[type=text],select,input[type=number]').each(function() {
            $(this).val('');
        });
        $('#form-search1').find('input[type=text],select,input[type=number]').each(function() {
            $(this).val('');
        });
         $('#form-search2').find('input[type=text],select,input[type=number]').each(function() {
             $(this).val('');
         });
        var jsondata = {
            name: '',
            deptName: '',
            duty: '',
            sex: '',
            firstXl: '',
            firstZy: '',
            firstSchool: '',
            lastXl: '',
            lastZy: '',
            lastSchool: '',
            hyStatus: '',
            political: '',
            doBest: '',
            bussTravel: '',
            birthPlace: '',
            minArrWorkYear: '',
            maxArrWorkYear: '',
            minArrComYear: '',
            maxArrComYear: '',
            maxAge: '',
            minAge: '',
            companyName: '',
            certName: '',
            doBests: ''
        }
        table.reload('tableList', {where: jsondata});
    }
    function saveTableWidth() {
        //把表格的宽度设置到数组里面：
        var theTable = $(".layui-table")[0];
        var theThs = $(theTable).find('th');
        $.each(theThs, function (ind, e) {
            if (ind > 6) {
                return false;
            }
            tableCols[0][ind].width = $(e)[0].clientWidth;
        })
    }

    function getTableByIndex(index) {
        //根据条件加载表格:
        if (index == 0) {
            //按照人员统计
            getTablePersonInfo();
            $("#hide").show();
        } else if (index == 1) {
            $("#hide").hide();
            //按照擅长领域统计
            getTableDoBest();
        } else if (index == 2) {
            $("#hide").hide();
            //按照证书统计
            getTableZf();
        }
    }

    var tableCols =  [[
        {checkbox: true, fixed: true, width: '5%'},
        {
            title: '序号', width: '100', align: 'center', templet: function (res) {
                return res.LAY_INDEX;
            }
        },
        {
            field: 'id', title: 'id', align: 'center', width: '10%', sort: true, hide: true
        },
        {
            field: 'name', title: '姓名', align: 'center', width: '100', sort: true, templet: function (d) {
                return '<span class="cursor" style="color: blue;" onclick="showDetailChange(\'' + d.id + '\')">' + d.name + '</span>';
            }
        },
        {
            field: 'birthday', title: '出生年月', align: 'center', width: '10%', sort: true, hide: true
        },
        {
            field: 'companyName', title: '所属公司', align: 'center', width: '100', sort: true
        },
        {
            field: 'deptName', title: '部门', align: 'center', width: '100', sort: true
        },
        {
            field: 'duty', title: '职务', align: 'center', width: '100', sort: true
        },
        {
            field: 'professor', title: '职称', align: 'center', width: '150', sort: true
        },
        {
            field: 'stationProfessor', title: '岗位职级', align: 'center', width: '150', sort: true
        },
        {
            field: 'email', title: '邮箱', align: 'center', width: '200', sort: true
        },
        {
            field: 'cardId', title: '身份证号', align: 'center', width: '200', sort: true
        },
        {
            field: 'sex', title: '性别', align: 'center', width: '100', sort: true, templet: function (d) {
                if (d.sex == '1') {
                    return '男';
                } else if (d.sex == '0') {
                    return '女';
                }
            }

        },
        {
            field: 'age', title: '年龄', align: 'center', width: '100', sort: true
        },
        {
            field: 'firstXl', title: '第一学历', align: 'center', width: '150', sort: true
        },
        {
            field: 'firstZy', title: '第一学历专业', align: 'center', width: '150', sort: true
        },
        {
            field: 'firstSchool', title: '第一学历学校', align: 'center', width: '150', sort: true
        },
        {
            field: 'lastXl', title: '最终学历', align: 'center', width: '150', sort: true
        },
        {
            field: 'lastZy', title: '最终学历专业', align: 'center', width: '150', sort: true
        },
        {
            field: 'lastSchool', title: '最终学历学校', align: 'center', width: '150', sort: true
        },
        {
            field: 'nation', title: '民族', align: 'center', width: '100', sort: true
        },
        {
            field: 'hyStatus', title: '婚姻状况', align: 'center', width: '100', sort: true
        },
        {
            field: 'political', title: '政治面貌', align: 'center', width: '100', sort: true
        },
        {
            field: 'birthPlace', title: '籍贯', align: 'center', width: '200', sort: true
        },
        {
            field: 'bloodType', title: '血型', align: 'center', width: '100', sort: true
        },
        {
            field: 'constellation', title: '星座', align: 'center', width: '100', sort: true
        },
        {
            field: 'zodiac', title: '属相', align: 'center', width: '100', sort: true
        },


        {
            field: 'phoneNumber', title: '联系电话', align: 'center', width: '150', sort: true
        },

        {
            field: 'emergencyContactName', title: '紧急联系人', align: 'center', width: '150', sort: true
        },

        {
            field: 'emergencyContractNumber', title: '紧急联系人电话', align: 'center', width: '100', sort: true
        },
        {
            field: 'doBest', title: '擅长领域', align: 'center', width: '200', sort: true
        },
        {
            field: 'goWorkTime', title: '工作时间', align: 'center', width: '200', sort: true
        },
        {
            field: 'arrivalCompanyTime', title: '到公司时间', align: 'center', width: '200', sort: true
        },
        {
            field: 'arrWorkDate', title: '工作年限', align: 'center', width: '200', sort: true
        },
        {
            field: 'arrComDate', title: '司龄', align: 'center', width: '200', sort: true
        },
        {
            field: 'bussTravel',
            title: '是否接受出差',
            align: 'center',
            width: '150',
            sort: true,
            templet: function (d) {
                if (d.bussTravel == '1') {
                    return '是';
                } else if (d.bussTravel == '0') {
                    return '否';
                } else {
                    return '';
                }
            }
        },
        {
            field: 'num', title: '持有证书数量', width: '200', align: 'center', sort: true
        },
        {
            field: 'certName',
            title: '持有证书',
            align: 'center',
            width: '300',
            sort: true,
            templet: function (d) {
                if (d.certName) {
                    return '<span class="cursor" style="color: blue;" onclick="userCertDetail(\'' + d.id + '\')">' + d.certName + '</span>';
                } else {
                    return "";
                }
            }
        }
    ]];
    layui.use('table', function () {
        table = layui.table;
        element = element;
        //方法级渲染
        tableIns = table.render({
            id: 'tableList',
            elem: '#tableList',
            url: '/search/personTj/selectPersonTjList',
            cols: tableCols,
            height: "350px",
            page: true,
            height: "auto",

            done: function (res, currentCount) {
                //***重点***：table渲染完成后渲染element进度条
                element.render();
                $(".layui-table-page select").css("width", "80px");

            }
        });

    });
    function getTablePersonInfo() {
        layui.use('table', function () {
            table = layui.table;
            element = element;
            //方法级渲染
            tableIns = table.render({
                id: 'tableList',
                elem: '#tableList',
                url: '/search/personTj/selectPersonTjList',
                height: "350px",
                page: true,
                height: "auto",
                cols: [[
                    {
                        title: '序号', width: '100', align: 'center', templet: function (res) {
                            return res.LAY_INDEX;
                        }
                    },
                    {
                        field: 'id', title: 'id', align: 'center', width: '10%', sort: true, hide: true
                    },
                    {
                        field: 'name', title: '姓名', align: 'center', width: '100', sort: true, templet: function (d) {
                            return '<span class="cursor" style="color: blue;" onclick="showDetailChange(\'' + d.id + '\')">' + d.name + '</span>';
                        }
                    },
                    {
                        field: 'birthday', title: '出生年月', align: 'center', width: '100', sort: true, hide: true
                    },
                    {
                        field: 'companyName', title: '所属公司', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'deptName', title: '部门', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'duty', title: '职务', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'professor', title: '职称', align: 'center', width: '150', sort: true
                    },
                    {
                        field: 'stationProfessor', title: '岗位职级', align: 'center', width: '150', sort: true
                    },
                    {
                        field: 'email', title: '邮箱', align: 'center', width: '200', sort: true
                    },
                    {
                        field: 'cardId', title: '身份证号', align: 'center', width: '200', sort: true
                    },
                    {
                        field: 'sex', title: '性别', align: 'center', width: '100', sort: true, templet: function (d) {
                            if (d.sex == '1') {
                                return '男';
                            } else if (d.sex == '0') {
                                return '女';
                            }
                        }

                    },
                    {
                        field: 'age', title: '年龄', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'firstXl', title: '第一学历', align: 'center', width: '150', sort: true
                    },
                    {
                        field: 'firstZy', title: '第一学历专业', align: 'center', width: '150', sort: true
                    },
                    {
                        field: 'firstSchool', title: '第一学历学校', align: 'center', width: '150', sort: true
                    },
                    {
                        field: 'lastXl', title: '最终学历', align: 'center', width: '150', sort: true
                    },
                    {
                        field: 'lastZy', title: '最终学历专业', align: 'center', width: '150', sort: true
                    },
                    {
                        field: 'lastSchool', title: '最终学历学校', align: 'center', width: '150', sort: true
                    },
                    {
                        field: 'nation', title: '民族', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'hyStatus', title: '婚姻状况', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'political', title: '政治面貌', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'birthPlace', title: '籍贯', align: 'center', width: '200', sort: true
                    },
                    {
                        field: 'bloodType', title: '血型', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'constellation', title: '星座', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'zodiac', title: '属相', align: 'center', width: '100', sort: true
                    },


                    {
                        field: 'phoneNumber', title: '联系电话', align: 'center', width: '150', sort: true
                    },

                    {
                        field: 'emergencyContactName', title: '紧急联系人', align: 'center', width: '150', sort: true
                    },

                    {
                        field: 'emergencyContractNumber', title: '紧急联系人电话', align: 'center', width: '100', sort: true
                    },
                    {
                        field: 'doBest', title: '擅长领域', align: 'center', width: '200', sort: true
                    },
                    {
                        field: 'goWorkTime', title: '工作时间', align: 'center', width: '200', sort: true
                    },
                    {
                        field: 'arrivalCompanyTime', title: '到公司时间', align: 'center', width: '200', sort: true
                    },
                    {
                        field: 'arrWorkDate', title: '工作年限', align: 'center', width: '200', sort: true
                    },
                    {
                        field: 'arrComDate', title: '司龄', align: 'center', width: '200', sort: true
                    },
                    {
                        field: 'bussTravel',
                        title: '是否接受出差',
                        align: 'center',
                        width: '150',
                        sort: true,
                        templet: function (d) {
                            if (d.bussTravel == '1') {
                                return '是';
                            } else if (d.bussTravel == '0') {
                                return '否';
                            } else {
                                return '';
                            }
                        }
                    },
                    {
                        field: 'num', title: '持有证书数量', width: '200', align: 'center', sort: true
                    },
                    {
                        field: 'certName',
                        title: '持有证书',
                        align: 'center',
                        width: '300',
                        sort: true,
                        templet: function (d) {
                            if (d.certName) {
                                return '<span class="cursor" style="color: blue;" onclick="userCertDetail(\'' + d.id + '\')">' + d.certName + '</span>';
                            } else {
                                return "";
                            }
                        }
                    }
                ]],
                done: function (res, currentCount) {
                    //***重点***：table渲染完成后渲染element进度条
                    element.render();
                    $(".layui-table-page select").css("width", "80px");

                }
            });

        });


    }

    //点击项目查询用户详情
    function showDetailChange(id) {
        var type = "auto";
        var w = "70%";
        var h = "90%";
        url = "/search/personTj/details?userId=" + id;
        layer.open({
            id: 'form-add',
            type: 2,
            area: [w, h],
            fix: false,
            maxmin: true,
            shadeClose: false,
            shade: 0.4,
            title: "人员基本信息",
            content: url,
            end: function () {

            }
        });
    }

    function getTableDoBest() {
        layui.use('table', function () {
            table = layui.table;
            element = element;
            //方法级渲染
            tableIns = table.render({
                id: 'tableList',
                elem: '#tableList',
                url: '/search/personTj/selectPersonDoBestList',
                height: "auto",
                page: true,
                cols: [[
                    {
                        title: '序号', width: '20%', align: 'center', templet: function (res) {
                            return res.LAY_INDEX;
                        }
                    },
                    {
                        field: 'doBestName', title: '擅长领域', align: 'center', width: '40%', sort: true
                    },
                    {
                        field: 'doBestCode', title: '擅长领域code', align: 'center', width: '40%', sort: true, hide: true
                    },
                    {
                        field: 'num', title: '人数', width: '40%', align: 'center', sort: true
                        , templet: function (d) {
                            return '<span class="cursor" style="color: blue;" onclick="dobestDetail(\'' + d.doBestCode + '\')">' + d.num + '</span>';
                        }
                    }
                ]],
                done: function (res, currentCount) {
                    //***重点***：table渲染完成后渲染element进度条
                    element.render();
                    $(".layui-table-page select").css("width", "80px");

                }
            });

        });

    }

    function getTableZf() {
        layui.use('table', function () {
            table = layui.table;
            element = element;
            //方法级渲染
            tableIns = table.render({
                id: 'tableList',
                elem: '#tableList',
                url: '/search/personTj/selectPersonCertList',
                height: "auto",
                page: true,
                cols: [[
                    {
                        title: '序号', width: '20%', align: 'center', templet: function (res) {
                            return res.LAY_INDEX;
                        }
                    },
                    {
                        field: 'certName', title: '证书名称', align: 'center', width: '40%', sort: true
                    },
                    {
                        field: 'num', title: '人数', width: '40%', align: 'center', sort: true
                        , templet: function (d) {
                            return '<span class="cursor" style="color: blue;" onclick="zsDetail(\'' + d.certName + '\')">' + d.num + '</span>';
                        }
                    }
                ]],
                done: function (res, currentCount) {
                    //***重点***：table渲染完成后渲染element进度条
                    element.render();
                    $(".layui-table-page select").css("width", "80px");

                }
            });

        });

    }

    function userCertDetail(id) {
        var title = "";
        var w = "";
        var h = "";
        if (w == null || w == '') {
            w = ($(window).width() - 200);
        }
        ;
        if (h == null || h == '') {
            h = ($(window).height() - 50);
        }
        var certName = certName;
        var url = "/search/personTj/certTjDetail?id=" + id;
        parent.layer.open({
            id: 'form-list',
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false,
            maxmin: true,
            shadeClose: false,
            shade: 0.4,
            title: title,
            content: url,
            success: function (layero) {
                layero.find('.layui-layer-min').remove();
            }
        });


    }


    function dobestDetail(dobest) {
        var title = "";
        var w = "";
        var h = "";
        if (w == null || w == '') {
            w = ($(window).width() - 200);
        }
        ;
        if (h == null || h == '') {
            h = ($(window).height() - 50);
        }
        var doBest = dobest;
        var url = "/search/personTj/doBestTjDetail?doBest=" + doBest;
        parent.layer.open({
            id: 'form-list',
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false,
            maxmin: true,
            shadeClose: false,
            shade: 0.4,
            title: title,
            content: url,
            success: function (layero) {
                layero.find('.layui-layer-min').remove();
            }
        });


    }

    function zsDetail(certName) {
        var title = "";
        var w = "";
        var h = "";
        if (w == null || w == '') {
            w = ($(window).width() - 200);
        }
        ;
        if (h == null || h == '') {
            h = ($(window).height() - 50);
        }
        var certName = certName;
        var url = "/search/personTj/certTjDetail?certName=" + encodeURI(certName);
        parent.layer.open({
            id: 'form-list',
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false,
            maxmin: true,
            shadeClose: false,
            shade: 0.4,
            title: title,
            content: url,
            success: function (layero) {
                layero.find('.layui-layer-min').remove();
            }
        });


    }


    function provinceChange(object) {
        var code = $(object).find('option:selected').val();
        if (code == "") {
            return;
        }
        layerAjaxGet('/sys/register/getOrganize', {"code": code}, '', function (d) {
            if (d.flag == true) {
                $(object).next().empty().append("<option value=''>选择市</option>");
                for (var i = 0; i < d.data.length; i++) {
                    $("#city").append("<option value='" + d.data[i].code + "'>" + d.data[i].name + "</option>");
                }
            } else {
                layer.msg(d.msg, {icon: 2});
            }
        });


    };

    function initsl() {
        layerAjaxGet("/search/personTj/getdeptName?", {}, "", function (d) {
            var rows = null;
            if (d.flag) {
                if (d.data) {
                    rows = d.data;
                }
                if (rows) {
                    var _ycols = ['companyName', 'companyName'];
                    var _gpakgs = [];
                    $.each(rows, function (i, v) {
                        _gpakgs.push({name: v[_ycols[0]], value: v[_ycols[0]]});
                    })
                    // console.log(_gpakgs);
                    _xstjlcpselect = xmSelect.render({
                        el: '#deptNameslt',
                        name: "deptNameslt",
                        radio: true,
                        filterable: true,
                        //layVerify: 'required',
                        toolbar: {show: true},
                        layVerType: 'msg',
                        data: _gpakgs,
                        strict: true
                    });

                    /*             $("xm-select").css({"min-height":"30px"}).css({"line-height":"30px"});*/


                }
            }

        });
    }

    // 导出 excel

    function exportTab(){
        var data = $(".layui-this").val();
        if(data =="1"){
            exportTable();
        }else if(data =="2"){
            exportCount();
        }else if(data =="3"){
            exportCountUser();
        }
    };

    function viewTab(){
        var data = $(".layui-this").val();
        if(data =="1"){
            viewTable();
        }else if(data =="2"){
            viewCount();
        }else if(data =="3"){
            viewCountUser();
        }
    };




    //导出
    function exportTable() {
        var name = $('#name').val();
        var deptName = $('#deptName').val()
        var companyName = _xstjlcpselect.getValue('valueStr');
        var duty = $('#duty').val();
        var sex = $('#sex').val();
        var firstXl = $('#firstXl').val();
        var firstZy = $('#firstZy').val();
        var firstSchool = $('#firstSchool').val();
        var lastXl = $('#lastXl').val();
        var lastZy = $('#lastZy').val();
        var lastSchool = $('#lastSchool').val();
        var hyStatus = $('#hyStatus').val();
        var political = $('#political').val();
        var doBest = $('#doBest').val();
        var bussTravel = $('#bussTravel').val();
        var birthPlace = $('#birthPlace').val();
        var minArrWorkYear = $('#minArrWorkYear').val();
        var maxArrWorkYear = $('#maxArrWorkYear').val();
        var minArrComYear = $('#minArrComYear').val();
        var maxArrComYear = $('#maxArrComYear').val();
        var minAge = $('#minAge').val();
        var maxAge = $('#maxAge').val();
        var url = '/search/personTj/exportTable?name=' + name + "&deptName" + deptName + "&duty" + duty + "&sex" + sex
            + "&firstXl" + firstXl + "&firstZy" + firstZy + "&firstSchool" + firstSchool + "&lastXl" + lastXl + "&lastZy" + lastZy
            + "&lastSchool" + lastSchool + "&hyStatus" + hyStatus + "&political" + political + "&doBest" + doBest
            + "&bussTravel" + bussTravel + "&birthPlace" + birthPlace + "&minArrWorkYear" + minArrWorkYear
            + "&maxArrWorkYear" + maxArrWorkYear + "&minArrComYear" + minArrComYear + "&maxArrComYear" + maxArrComYear
            + "&maxAge" + maxAge + "&minAge" + minAge + "&companyName" + companyName;
        location.href = url;
    }

    //预览
    function viewTable() {
        var jsonData = json();
        layerAjaxGet('/search/personTj/viewTable', jsonData, '', function (res) {
            if (res.flag) {
                if (res.data) {
                    var w = ($(window).width() * 0.8);
                    var h = ($(window).height() * 0.8);
                    POBrowser.openWindowModeless('/sys/office/openwordTemp?ft=1&fid=' + res.data, 'width=1200px;height=800px;', '{}')
                }
            }
        })
    }

    //按擅长领域导出
    function exportCount() {
        var doBest = $('#doBests').val();
        var url = '/search/personTj/exportCount?doBest=' + doBest;
        location.href = url;
    }

    //擅长领域预览
    function viewCount() {
        var jsonData = json2();
        layerAjaxGet('/search/personTj/viewCount', jsonData, '', function (res) {
            if (res.flag) {
                if (res.data) {
                    var w = ($(window).width() * 0.8);
                    var h = ($(window).height() * 0.8);
                    POBrowser.openWindowModeless('/sys/office/openwordTemp?ft=1&fid=' + res.data, 'width=1200px;height=800px;', '{}')
                }
            }
        })
    }

    //导出预览获取筛选数据用
    function json2() {
        var doBest = $('#doBests').val();
        var jsondata = {
            doBest: doBest
        };
        return jsondata;
    }

    //按证书拥有人统计导出
    function exportCountUser() {
        var certName = $('#certName').val();
        var url = '/search/personTj/exportCountUser?certName=' + certName
        location.href = url;
    }

    //按证书拥有人统计预览
    function viewCountUser() {
        var jsonData = json3();
        layerAjaxGet('/search/personTj/viewCountUser', jsonData, '', function (res) {
            if (res.flag) {
                if (res.data) {
                    var w = ($(window).width() * 0.8);
                    var h = ($(window).height() * 0.8);
                    POBrowser.openWindowModeless('/sys/office/openwordTemp?ft=1&fid=' + res.data, 'width=1200px;height=800px;', '{}')
                }
            }
        })
    }

    //导出证书拥有人预览获取筛选数据用
    function json3() {
        var certName = $('certName').val()
        var jsonData = {
            certName: certName
        };
        return jsonData;
    }

    //导出预览获取筛选数据用
    function json() {
        var name = $('#name').val();
        var deptName = $('#deptName').val()
        var companyName = _xstjlcpselect.getValue('valueStr');
        var duty = $('#duty').val();
        var sex = $('#sex').val();
        var firstXl = $('#firstXl').val();
        var firstZy = $('#firstZy').val();
        var firstSchool = $('#firstSchool').val();
        var lastXl = $('#lastXl').val();
        var lastZy = $('#lastZy').val();
        var lastSchool = $('#lastSchool').val();
        var hyStatus = $('#hyStatus').val();
        var political = $('#political').val();
        var doBest = $('#doBest').val();
        var bussTravel = $('#bussTravel').val();
        var birthPlace = $('#birthPlace').val();
        var minArrWorkYear = $('#minArrWorkYear').val();
        var maxArrWorkYear = $('#maxArrWorkYear').val();
        var minArrComYear = $('#minArrComYear').val();
        var maxArrComYear = $('#maxArrComYear').val();
        var minAge = $('#minAge').val();
        var maxAge = $('#maxAge').val();
        var jsondata = {
            name: name,
            deptName: deptName,
            duty: duty,
            sex: sex,
            firstXl: firstXl,
            firstZy: firstZy,
            firstSchool: firstSchool,
            lastXl: lastXl,
            lastZy: lastZy,
            lastSchool: lastSchool,
            hyStatus: hyStatus,
            political: political,
            doBest: doBest,
            bussTravel: bussTravel,
            birthPlace: birthPlace,
            minArrWorkYear: minArrWorkYear,
            maxArrWorkYear: maxArrWorkYear,
            minArrComYear: minArrComYear,
            maxArrComYear: maxArrComYear,
            maxAge: maxAge,
            minAge: minAge,
            companyName: companyName
        };
        return jsondata;
    }
    $(function () {
        //回车事件
        $(document).keydown(function(e){
            // 兼容FF和IE和Opera
            var theEvent = e || window.event;
            var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
            if (code == 13) {
                var y=0;
                $(".layui-tab-title").find("li").each(function (i,v){
                    var ss= $(v).hasClass("layui-this");
                    if(ss){
                        y=i;
                    }
                });
                if(y==0){
                    query(1);
                }else  if(y==1){
                    query(2);
                }else  if(y==2){
                    query(3);
                }

            }
            return true;
        });
    })


</script>
</body>

</html>
